package com.hsylient.javase.chapter10;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.SerializerFeature;
import lombok.Data;

import java.util.HashMap;
import java.util.Map;

public class MyFastJSON {

    public static void main(String[] args) {
        Student student = new Student();
        student.setName("hsylient");
        Map<Integer, Student> map = new HashMap<>();
        map.put(1, student);
        map.put(2, student);
        map.put(3, student);
        System.out.println(JSON.toJSONString(map));

    }

    @Data
    private static class Student {
        @JSONField(serialzeFeatures = SerializerFeature.DisableCircularReferenceDetect)
        private String name;
    }
}
